package com.gamelife.web.utils;

import com.gamelife.web.domain.LoginUser;
import com.gamelife.web.domain.entity.SysUser;
import org.springframework.security.core.context.SecurityContextHolder;

public class SecurityUtils {
    public static SysUser getUser(){
        LoginUser loginUser = (LoginUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return loginUser.getSysUser();
    }

    public static Long getUserId(){
        return getUser().getId();
    }
}
